package cn.com.okgo.request;

import android.text.TextUtils;

import cn.com.okgo.request.base.BodyRequest;
import cn.com.okgo.utils.HttpUtils;
import okhttp3.Request;
import okhttp3.RequestBody;

/**
 * Created by luwenlong on 2017/8/28.
 */

public class PostRequest<T> extends BodyRequest<T, PostRequest> {
    public PostRequest(String url) {
        super( url );
    }

    @Override
    public Request generateRequest(RequestBody requestBody) {
        String realUrl = TextUtils.isEmpty( baseUrl ) ? url : baseUrl + url;
        Request.Builder requestBuilder = new Request.Builder();
        return HttpUtils.appendHeaders( requestBuilder, headers ).url( realUrl ).tag( tag ).build();
    }
}
